package top.tocchen.bookshop.service.impl;

import top.tocchen.bookshop.dao.BookDao;
import top.tocchen.bookshop.dao.CategoryDao;
import top.tocchen.bookshop.dao.ordernumDao;
import top.tocchen.bookshop.entity.BookEntity;
import top.tocchen.bookshop.entity.CategoryEntity;
import top.tocchen.bookshop.entity.OrderNum;
import top.tocchen.bookshop.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SearchServiceImpl implements SearchService {
    @Autowired
    BookDao bookDao;
    @Autowired
    CategoryDao categoryDao;
    @Autowired
    ordernumDao orderNum;
    @Override
    public List<CategoryEntity> CategoryfindAll() {
        return categoryDao.findAll();
    }

    @Override
    public List<BookEntity> findByStr(String str) {
        return bookDao.findByStr(str);
    }

    @Override
    public List<BookEntity> findByCategoryId(Integer categoryid) {
        return bookDao.findByCateoryId(categoryid);
    }

    @Override
    public BookEntity findByBookId(Integer id) {
        return bookDao.findByBookId(id);
    }

    @Override
    public List<BookEntity> findBydate() {
        return bookDao.findBydate();
    }

    @Override
    public OrderNum getNum() {
        return orderNum.getNum();
    }

    @Override
    public void saveNum(int value) {
        orderNum.saveNum(value);
    }

    @Override
    public CategoryEntity categoryfindById(Integer categoryid){
        return categoryDao.categoryfindById(categoryid);
    }

}
